package com.suse.lhw.hms.foodserver.service.Impl;

import com.suse.lhw.hms.foodserver.dao.FFoodmodelMapper;
import com.suse.lhw.hms.foodserver.domin.FFoodmodel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.suse.lhw.hms.foodserver.dao.FFoodIfoMapper;
import com.suse.lhw.hms.foodserver.domin.FFoodIfo;
import com.suse.lhw.hms.foodserver.service.FFoodIfoService;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ProjectName: health_manage_system
 * @Package: com.suse.lhw.hms.foodserver.service.Impl
 * @ClassName: FFoodIfoServiceImpl
 * @Description: java类作用描述
 * @Author: 李鸿炜
 * @CreateDate: 2020/4/24 17:39
 * @UpdateUser: 更新者
 * @UpdateDate: 2020/4/24 17:39
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class FFoodIfoServiceImpl implements FFoodIfoService {

    @Resource
    private FFoodIfoMapper fFoodIfoMapper;
    @Resource
    private FFoodmodelMapper fFoodmodelMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return fFoodIfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(FFoodIfo record) {
        return fFoodIfoMapper.insert(record);
    }

    @Override
    public int insertSelective(FFoodIfo record) {
        return fFoodIfoMapper.insertSelective(record);
    }

    @Override
    public FFoodIfo selectByPrimaryKey(Integer id) {
        return fFoodIfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(FFoodIfo record) {
        return fFoodIfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(FFoodIfo record) {
        return fFoodIfoMapper.updateByPrimaryKey(record);
    }

    @Override
    public FFoodIfo selectFoolIfoByModelId(int modelId) {
        FFoodmodel fFoodmodel = fFoodmodelMapper.selectByPrimaryKey(modelId);
        FFoodIfo ifo = fFoodIfoMapper.selectByPrimaryKey(fFoodmodel.getFmsgId());
        System.out.println("得到ifo的信息：" + ifo.toString());
        return ifo;
    }

}
